package breadbox.client.logging;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;

import breadbox.client.files.Chunk;

/**
 * Defines the classes of a Logger, which tracks files on the client
 * @author Forrest
 *
 */
public interface Log {
	/** Directory where log files are stored **/
	public final String LOG_DIRECTORY = "log/";
	/** File extension for log files **/
	public final String LOG_FILE_EXTENSION = ".log";
	
	/**
	 * Write a chunk to the log file
	 * @param k Chunk to log
	 * @throws IOException 
	 */
	public void writeChunks(List<Chunk> chunks, boolean compression) throws IOException;
	
	/**
	 * Read all data regarding a file from the log
	 * @param filename
	 * @return List<Chunk> data
	 * @throws FileNotFoundException 
	 */
	public List<LogChunk> read(String filename) throws FileNotFoundException;
	
	/**
	 * List the files in the system
	 * @return
	 */
	public List<String> list();
	
	/**
	 * List the ids in a file from the log
	 * @param filename
	 * @return long[] ids
	 * @throws FileNotFoundException 
	 */
	public long[] getIds(String filename) throws FileNotFoundException;

	/**
	 * Remove the log for this file
	 * @param filename
	 */
	public void remove(String filename);

	/**
	 * Returns the compression status for this file
	 * @param filename
	 * @throws FileNotFoundException 
	 */
	public boolean getCompression(String filename) throws FileNotFoundException;
	
	/**
	 * Returns if a file exists in the log
	 * @param filename
	 * @return boolean indicating if file exists
	 */
	public boolean exists(String filename);
}
